package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.user.service.ApUserImportAndExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@Api(value = "app端用户批量导入或导出",tags = "app端用户批量导入或导出")
@RestController
@RequestMapping("/api/v1/apex")
public class ApUserImportExportController {

    @Autowired
    ApUserImportAndExportService apUserImportAndExportService;

    @ApiOperation("批量注册App用户")
    @PostMapping("/import")
    public ResponseResult importApUser(MultipartFile file) throws IOException {
        return apUserImportAndExportService.importApUser(file);
    }

    @ApiOperation("批量下载未注册成功用户")
    @GetMapping("/export")
    public ResponseResult exportApUser(@RequestParam("repetitionId") String repetitionId, HttpServletResponse response) throws IOException {
        return apUserImportAndExportService.exportApUser(repetitionId,response);
    }


}
